package mutsumimod.cards.custom;

import com.megacrit.cardcrawl.actions.common.GainEnergyAction;
import com.megacrit.cardcrawl.actions.common.ReducePowerAction;
import com.megacrit.cardcrawl.cards.AbstractCard;
import com.megacrit.cardcrawl.characters.AbstractPlayer;
import com.megacrit.cardcrawl.monsters.AbstractMonster;
import mutsumimod.cards.BaseCard;
import mutsumimod.character.Mutsumi;
import mutsumimod.powers.StandPower;
import mutsumimod.util.CardStats;

public class LetMeToHer extends BaseCard {
    public static final String ID = makeID(LetMeToHer.class.getSimpleName());
    private static final int ENERGY_AMT = 2;
    public static final CardStats info = new CardStats(
            Mutsumi.Meta.CARD_COLOR,
            CardType.SKILL,
            CardRarity.UNCOMMON,
            CardTarget.SELF,
            0
    );

    public LetMeToHer() {
        super(ID, info);
        this.magicNumber = this.baseMagicNumber = 2;
        this.isEthereal = true;
    }

    @Override
    public void use(AbstractPlayer p, AbstractMonster m) {
        StandPower power = (StandPower) p.getPower(StandPower.POWER_ID);
        if (power == null || power.amount < this.magicNumber) {
            this.exhaust = true;
            return;
        }
        this.addToBot(new ReducePowerAction(p, p, StandPower.POWER_ID, this.magicNumber));
        this.addToBot(new GainEnergyAction(ENERGY_AMT));
    }

    @Override
    public AbstractCard makeCopy() {
        return new LetMeToHer();
    }

    @Override
    public void upgrade() {
        if(this.upgraded) {
            return;
        }
        this.upgradeName();
        this.isEthereal = false;
        //升级变弱是不是写错了
        //this.upgradeMagicNumber(1);
        this.rawDescription = cardStrings.UPGRADE_DESCRIPTION;
        this.initializeDescription();
    }

}
